package com.cskaoyan;

import com.cskaoyan.mapper.StudentMapper;
import com.cskaoyan.utils.MybatisUtils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

/**
 * 创建日期: 2022/05/19 14:37
 *
 * @author ciggar
 */
public class Main {

    public static void main(String[] args) {

//        InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
//        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
//        SqlSession sqlSession1 = sessionFactory.openSession();

        SqlSession sqlSession = MybatisUtils.getSqlSession();


        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
        String name = studentMapper.selectNameById(1);




//        String name = sqlSession.selectOne("com.cskaoyan.mapper.StudentMapper.selectNameById", 1);



        System.out.println(name);

    }
}
